package com.mogu.comment.annotion;

import com.mogu.comment.Messages;
import com.mogu.comment.constraint.RangValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;

/**
 * Description:不在能知，而在能行
 *字符串范围约束
 * @author: 梁西华
 * @date: 2020/6/11/14:19
 **/
@Target({TYPE, ANNOTATION_TYPE, FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = {RangValidator.class})
public @interface Range {
    long min() default 0;

    long max() default Long.MAX_VALUE;


    //String CK_RANGE_DEFAULT = "should be an integer,between {min} and {max}";
    String message() default Messages.CK_RANGE_DEFAULT;

    String value() default "";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
